<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Gloze: element</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Gloze
   &#160;<span id="projectnumber">1.01-beta2</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Packages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="components.html">Schema Components</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">element </div>  </div>
</div>
<div class="contents">
<div class="textblock"><p>Elements map to RDF properties. An instance of an element maps to an RDF statement. A qualified element is defined in the target namespace of the schema, as is the corresponding RDF property. Where an element has a complex type we define a corresponding OWL ObjectProperty. Where an attribute or element has an RDF recommended simple type we define a corresponding OWL DatatypeProperty. Attribute and elements of non-recommended simple types form a grey zone with literal types (anySimpleType and ENTITY) still requiring a DatatypeProperty, but the URI (QName, NOTATION, IDREF) and structured types (duration, ENTITIES, IDREFS, NMTOKENS) switch; demanding an ObjectProperty. Where content has a named type (or if there is an explicit xsi:type) this is represented by an rdf:type statement on the node.</p>
<p>e.g. for target namespace <a href="http://example.org/">http://example.org/</a> and element named 'foo', the RDF property name is <a href="http://example.org/foo">http://example.org/foo</a></p>
<div class="fragment"><pre class="fragment">&lt;?xml version=<span class="stringliteral">&quot;1.0&quot;</span> encoding=<span class="stringliteral">&quot;UTF-8&quot;</span>?&gt;
&lt;xs:schema xmlns:xs=<span class="stringliteral">&quot;http://www.w3.org/2001/XMLSchema&quot;</span> targetNamespace=<span class="stringliteral">&quot;http://example.org/&quot;</span>&gt;
        &lt;xs:element name=<span class="stringliteral">&quot;foo&quot;</span> type=<span class="stringliteral">&quot;xs:string&quot;</span> /&gt;
&lt;/xs:schema&gt;
</pre></div><p>The OWL mapping was produced with lang=N3. This shows the property definition for 'foo'. It is a datatype property ranging over xs:string.</p>
<div class="fragment"><pre class="fragment">@prefix ns2:     &lt;http:<span class="comment">//example.org/&gt; .</span>
@prefix rdfs:    &lt;http:<span class="comment">//www.w3.org/2000/01/rdf-schema#&gt; .</span>
@prefix ns1:     &lt;http:<span class="comment">//example.org/def/&gt; .</span>
@prefix xs_:     &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema#&gt; .</span>
@prefix owl:     &lt;http:<span class="comment">//www.w3.org/2002/07/owl#&gt; .</span>
@prefix xsd:     &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema#&gt; .</span>
@prefix rdf:     &lt;http:<span class="comment">//www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .</span>
@prefix xs:      &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema&gt; .</span>

ns2:foo
      a       rdf:Property , owl:DatatypeProperty ;
      rdfs:range xsd:<span class="keywordtype">string</span> .

&lt;http:<span class="comment">//example.org/element1.owl&gt;</span>
      a       owl:Ontology .
</pre></div><p>Where the target namespace ends with an alphanumeric character, a fragment separator is introduced. e.g. for target namespace <a href="http://example.org">http://example.org</a> and element named 'foo', the RDF property name is <a href="http://example.org#foo">http://example.org#foo</a></p>
<div class="fragment"><pre class="fragment">&lt;?xml version=<span class="stringliteral">&quot;1.0&quot;</span> encoding=<span class="stringliteral">&quot;UTF-8&quot;</span>?&gt;
&lt;xs:schema xmlns:xs=<span class="stringliteral">&quot;http://www.w3.org/2001/XMLSchema&quot;</span> targetNamespace=<span class="stringliteral">&quot;http://example.org&quot;</span>&gt;
        &lt;xs:element name=<span class="stringliteral">&quot;foo&quot;</span> type=<span class="stringliteral">&quot;xs:string&quot;</span> /&gt;
&lt;/xs:schema&gt;
</pre></div><p>This OWL was produced with lang=N3</p>
<div class="fragment"><pre class="fragment">@prefix ns2:     &lt;http:<span class="comment">//example.org#&gt; .</span>
@prefix rdfs:    &lt;http:<span class="comment">//www.w3.org/2000/01/rdf-schema#&gt; .</span>
@prefix ns1:     &lt;http:<span class="comment">//example.org/def/&gt; .</span>
@prefix xs_:     &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema#&gt; .</span>
@prefix owl:     &lt;http:<span class="comment">//www.w3.org/2002/07/owl#&gt; .</span>
@prefix xsd:     &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema#&gt; .</span>
@prefix rdf:     &lt;http:<span class="comment">//www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .</span>
@prefix xs:      &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema&gt; .</span>

&lt;http:<span class="comment">//example.org/element2.owl&gt;</span>
      a       owl:Ontology .

ns2:foo
      a       rdf:Property , owl:DatatypeProperty ;
      rdfs:range xsd:<span class="keywordtype">string</span> .
</pre></div><p>Unqualified elements are not defined in the target namespace, but the mapping to RDF requires an absolute URI. Unqualified elements occur if no target namespace is defined, or if an element is declared locally and its form is unqualified. The properties corresponding to unqualified elements will be declared in the user-defined default namespace (xmlns) of the schema. This is a command line parameter (not the xmlns defined on the document element).</p>
<p>e.g. for default namespace <a href="http://example.com/def/">http://example.com/def/</a> and unqualified element named 'foo', the RDF property name is <a href="http://example.org/def/foo">http://example.org/def/foo</a></p>
<div class="fragment"><pre class="fragment">&lt;?xml version=<span class="stringliteral">&quot;1.0&quot;</span> encoding=<span class="stringliteral">&quot;UTF-8&quot;</span>?&gt;
&lt;xs:schema xmlns:xs=<span class="stringliteral">&quot;http://www.w3.org/2001/XMLSchema&quot;</span>&gt;
        &lt;xs:element name=<span class="stringliteral">&quot;foo&quot;</span> type=<span class="stringliteral">&quot;xs:string&quot;</span> /&gt;
&lt;/xs:schema&gt;
</pre></div><p>The OWL mapping was produced with lang=N3 and xmlns=<a href="http://example.com/def/">http://example.com/def/</a></p>
<div class="fragment"><pre class="fragment">@prefix rdfs:    &lt;http:<span class="comment">//www.w3.org/2000/01/rdf-schema#&gt; .</span>
@prefix ns1:     &lt;http:<span class="comment">//example.org/def/&gt; .</span>
@prefix xs_:     &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema#&gt; .</span>
@prefix owl:     &lt;http:<span class="comment">//www.w3.org/2002/07/owl#&gt; .</span>
@prefix xsd:     &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema#&gt; .</span>
@prefix rdf:     &lt;http:<span class="comment">//www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .</span>
@prefix xs:      &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema&gt; .</span>

&lt;http:<span class="comment">//example.org/element3.owl&gt;</span>
      a       owl:Ontology .

ns1:foo
      a       rdf:Property , owl:DatatypeProperty ;
      rdfs:range xsd:<span class="keywordtype">string</span> .
</pre></div><p>In xml schema, elements have their own symbol space, distinct from other components such as attributes and types. If there are overlaps between these symbol spaces, it is advisable to introduce a symbolic prefix to keep them distinct.</p>
<p>e.g. the element named 'foo' and type named 'foo' in the target namespace <a href="http://example.org/">http://example.org/</a> will clash. Introducing a symbolic prefix '~' (at the command line) for elements resolves the clash giving us an RDF property name <a href="http://example.org/~foo.">http://example.org/~foo.</a></p>
<p>The OWL mapping below was generated from the first schema above, but with element=~</p>
<div class="fragment"><pre class="fragment">@prefix ns2:     &lt;http:<span class="comment">//example.org/&gt; .</span>
@prefix rdfs:    &lt;http:<span class="comment">//www.w3.org/2000/01/rdf-schema#&gt; .</span>
@prefix ns1:     &lt;http:<span class="comment">//example.org/def/&gt; .</span>
@prefix xs_:     &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema#&gt; .</span>
@prefix owl:     &lt;http:<span class="comment">//www.w3.org/2002/07/owl#&gt; .</span>
@prefix xsd:     &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema#&gt; .</span>
@prefix rdf:     &lt;http:<span class="comment">//www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .</span>
@prefix xs:      &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema&gt; .</span>

&lt;http:<span class="comment">//example.org/element4.owl&gt;</span>
      a       owl:Ontology .

&lt;http:<span class="comment">//example.org/~foo&gt;</span>
      a       rdf:Property , owl:DatatypeProperty ;
      rdfs:range xsd:<span class="keywordtype">string</span> .
</pre></div><h2><a class="anchor" id="Type"></a>
Type</h2>
<p>An element may have a simple or complex type. On the whole, simple typed elements map to OWL datatype properties (exceptions include most of the datatypes that don't have a clean mapping into RDF); while complex typed elements map to object properties.</p>
<p>The schema below defines a simple typed property 'foo' and a complex type property 'bar'.</p>
<div class="fragment"><pre class="fragment">&lt;?xml version=<span class="stringliteral">&quot;1.0&quot;</span> encoding=<span class="stringliteral">&quot;UTF-8&quot;</span>?&gt;
&lt;xs:schema xmlns:xs=<span class="stringliteral">&quot;http://www.w3.org/2001/XMLSchema&quot;</span> 
        targetNamespace=<span class="stringliteral">&quot;http://example.org/&quot;</span> xmlns=<span class="stringliteral">&quot;http://example.org/&quot;</span>&gt;
        
        &lt;xs:element name=<span class="stringliteral">&quot;foo&quot;</span> type=<span class="stringliteral">&quot;xs:string&quot;</span> /&gt;
        
        &lt;xs:element name=<span class="stringliteral">&quot;bar&quot;</span>&gt;
                &lt;xs:complexType mixed=<span class="stringliteral">&quot;true&quot;</span> /&gt;
        &lt;/xs:element&gt;

&lt;/xs:schema&gt;
</pre></div><p>With a corresponding OWL mapping:</p>
<div class="fragment"><pre class="fragment">@prefix ns2:     &lt;http:<span class="comment">//example.org/def/&gt; .</span>
@prefix rdfs:    &lt;http:<span class="comment">//www.w3.org/2000/01/rdf-schema#&gt; .</span>
@prefix ns1:     &lt;http:<span class="comment">//example.org/&gt; .</span>
@prefix xs_:     &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema#&gt; .</span>
@prefix owl:     &lt;http:<span class="comment">//www.w3.org/2002/07/owl#&gt; .</span>
@prefix xsd:     &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema#&gt; .</span>
@prefix rdf:     &lt;http:<span class="comment">//www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .</span>
@prefix xs:      &lt;http:<span class="comment">//www.w3.org/2001/XMLSchema&gt; .</span>

&lt;http:<span class="comment">//example.org/element5.owl&gt;</span>
      a       owl:Ontology .

ns1:bar
      a       owl:ObjectProperty .

ns1:foo
      a       rdf:Property , owl:DatatypeProperty ;
      rdfs:range xsd:<span class="keywordtype">string</span> .
</pre></div><p>An element may reference or directly include a simple type declaration.</p>
<h2><a class="anchor" id="elementChildren"></a>
Child components</h2>
<ul>
<li><a class="el" href="simple_type.html">simpleType</a></li>
<li><a class="el" href="complex_type.html">complexType</a></li>
<li><a class="el" href="annotation.html">annotation</a> </li>
</ul>
</div></div>


<hr class="footer"/><address class="footer"><small>
Generated on Tue Nov 15 2011 22:13:50 for Gloze by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
